package com.netsdk.demo.customize.OtherDemo;

import com.netsdk.demo.util.CaseMenu;
import com.netsdk.lib.structure.NET_IN_GET_LASER_DISTANCE;
import com.netsdk.lib.structure.NET_OUT_GET_LASER_DISTANCE;
import com.netsdk.lib.utils.Initialization;

import java.util.Scanner;

public class LaserGetDemo extends Initialization {

    static Scanner sc = new Scanner(System.in);

    /**
     *  获取画面中心位置目标的距离
     */
    public static void getLaserDistance() {
        NET_IN_GET_LASER_DISTANCE input = new NET_IN_GET_LASER_DISTANCE();
        input.nChannel = 0;
        input.write();
        NET_OUT_GET_LASER_DISTANCE outPut = new NET_OUT_GET_LASER_DISTANCE();
        outPut.write();

        if(netSdk.CLIENT_GetLaserDistance(loginHandle, input.getPointer(), outPut.getPointer(), 3000)){
            System.out.println("GetLaserDistance succeed");
            outPut.read();
            System.out.println("unDistance = " + outPut.unDistance);
        } else {
            System.out.println("GetLaserDistance failed");
        }
    }

    public void RunTest()
    {
        System.out.println("Run Test");
        CaseMenu menu = new CaseMenu();
        menu.addItem((new CaseMenu.Item(this , "getLaserDistance" , "getLaserDistance")));
        menu.run();
    }

    public static void main(String[] args) {
        LaserGetDemo laserGetDemo=new LaserGetDemo();
//        System.out.println("输入 ip,port,user, password 格式如：172.11.243.30,37777,admin,admin123");
//        String s
//                = sc.nextLine();
//        String[] split
//                = s.split(",");
//        InitTest(split[0],Integer.parseInt(split[1]),split[2],split[3]);
        Initialization.InitTest("10.35.252.129", 37777, "admin", "admin123");
        laserGetDemo.RunTest();
        LoginOut();
    }
}
